########## lab 4 ################

#part1
plotsim=function(mat)
{
	plot(seq(1:50),mat[,3], xlab="time", ylab="abundance", ylim=c(1,200))
	lines(mat[,1])
}

#part 2 (pupal cannablism)
plotsim(lpa(T=50, mua=0.96, cpa=0.1))


##### part c
#pupal cannibalism = cpa
plot(NA, xlim=c(0, 1), ylim=c(0, 300), xlab = "cpa", ylab="adult population")
r = seq(0, 1, length=101)

#for each value of r
for (i in 1:length(r))
{
	mat <- lpa(T=1000,mua=0.96,cpa=r[i])
	points(rep(r[i], 500), mat[501:1000,3], pch=".")
}